package com.vq3.digitalizationsoftwareintegrates.Utils.ImageUtil;

import com.vq3.digitalizationsoftwareintegrates.Entity.Enum.Group_Type;
import com.vq3.digitalizationsoftwareintegrates.Entity.Enum.MessageType;
import com.vq3.digitalizationsoftwareintegrates.Entity.Enum.StatusType;
import org.springframework.stereotype.Component;

@Component
public class CalculationIsType {

    /**计算提交状态
     * */
    public static StatusType calculationIsStatusType(String status) {
        if (status.equalsIgnoreCase(StatusType.ReviewNG.toString())){
            return StatusType.ReviewNG;
        }else if (status.equalsIgnoreCase(StatusType.NotSubmitted.toString())){
            return StatusType.NotSubmitted;
        }else if (status.equalsIgnoreCase(StatusType.Submitted.toString())) {
            return StatusType.Submitted;
        }else if (status.equalsIgnoreCase(StatusType.ReviewPassed.toString())) {
            return StatusType.ReviewPassed;
        }else{
            return StatusType.obsolete;
        }
    }
    /**计算组别
     * */
    public static Group_Type calculationIsGroupType(String groupStr1){
        String groupStr = groupStr1.replace("\"", "").replace("[","").replace("]","");
        if (groupStr.equalsIgnoreCase(Group_Type.Final_Check1.toString())) {
            return Group_Type.Final_Check1;
        }else if (groupStr.equalsIgnoreCase(Group_Type.Final_Check2.toString())) {
            return Group_Type.Final_Check2;
        }else if (groupStr.equalsIgnoreCase(Group_Type.Manage.toString())) {
            return Group_Type.Manage;
        }else if (groupStr.equalsIgnoreCase(Group_Type.Sampling.toString())) {
            return Group_Type.Sampling;
        }else {
            return Group_Type.Err;
        }
    }
    /**计算组别Value
     * */
    public static Group_Type calculationIsGroupTypeValue(String groupStr){

        if (groupStr.equalsIgnoreCase(Group_Type.Final_Check1.getValue())) {
            return Group_Type.Final_Check1;
        }else if (groupStr.equalsIgnoreCase(Group_Type.Final_Check2.getValue())) {
            return Group_Type.Final_Check2;
        }else if (groupStr.equalsIgnoreCase(Group_Type.Manage.getValue())) {
            return Group_Type.Manage;
        }else if (groupStr.equalsIgnoreCase(Group_Type.Sampling.getValue())) {
            return Group_Type.Sampling;
        }else {
            return Group_Type.Err;
        }
    }
    /**计算组别在数据库的分类
     * */
    public static Integer calculationIsGroupTypeToMySql(Group_Type group_type) {
        if (group_type == Group_Type.Final_Check1) {
            return 1;
        }else if (group_type == Group_Type.Final_Check2) {
            return 2;
        }else if (group_type == Group_Type.Manage) {
            return 3;
        }else if (group_type == Group_Type.Sampling) {
            return 4;
        }else if (group_type == Group_Type.SuperUser) {
            return 5;
        }else {
            return 0;
        }

    }
    /**数据库取组别信息的*/
    /**计算消息类型
     * */
    public static MessageType calculationIsMessageType(String messageType) {
        if (messageType.equalsIgnoreCase(MessageType.S_CAddAuditMessage.toString())) {
            return MessageType.S_CAddAuditMessage;
        } else if (messageType.equalsIgnoreCase(MessageType.S_CServiceAuditMessage.toString())) {
            return MessageType.S_CServiceAuditMessage;
        }else if (messageType.equalsIgnoreCase(MessageType.SysMessage.toString())) {
            return MessageType.SysMessage;
        }else if (messageType.equalsIgnoreCase(MessageType.NormalMessages.toString())) {
            return MessageType.NormalMessages;
        }else if (messageType.equalsIgnoreCase(MessageType.SCExceptionCorrespondence.toString())){
            return MessageType.SCExceptionCorrespondence;
        }else {
            return MessageType.ErrType;
        }
    }
}
